import axios from "axios";

export default {
  namespaced: true,
  state: {
    ArticleTable: [],
    page: 1,
  },
  mutations: {
    SET_Article_Table(state, data) {
      state.ArticleTable = data;
    },
    SET_PAGE(state, data) {
      state.page = data;
    },
  },
  actions: {
    async GetArticleTable({ commit }, page) {
      const res = await axios({
        url: `http://localhost:10000/ArticleTable?_page=${page}&_limit=5&_sort=id&_order=desc`,
      });
      commit("SET_Article_Table", res.data);
    },
  },
};
